# kojibuild_ policies are for koji_build subjects; Fedora CI runs tests at
# at the Koji build level and report results which will be found by queries
# against these policies.

# bodhiupdate_ policies are for bodhi_update subjects; Fedora openQA runs
# tests at the Bodhi update level and reports results which will be found by
# queries against these policies.

# As of 2020-11, we know that Bodhi runs queries for both of these subject
# types when deciding whether to push updates to various stages (these are the
# decision contexts), and expects a successful result to its queries.

# compose_ policies are for compose subjects; Fedora openQA runs tests at
# the compose level (for composes containing deliverables it can test) and
# reports results which will be found by queries against these policies.
# As of 2020-11, we know the check-compose tool that generates "compose
# check reports" queries this subject type for the
# rawhide_compose_sync_to_mirrors decision context and reports the result
# for each Rawhide compose, saying whether it "would have" passing gating
# or not (actual gating of compose syncs has not yet been implemented).

# note that policies are *additive*. If a query matches multiple of these
# policies, all the relevant test results are retrieved, and rules in all
# the matched policies are applied.

# These are "null" policies: they enforce no rules, the purpose is just to
# exist, so that we always have at least one policy that matches
# queries for the covered subject types and the covered versions and
# contexts. This is a fallback for Bodhi queries that we know will run
# and expect a successful result, but which Greenwave will error on if
# no policy matches. Note having no "null" policy for subject_type
# bodhi_update would not cause an error because Greenwave by default
# ignores missing policies for that subject type, but if there is no
# policy match Greenwave won't send Bodhi the test results, and we do want
# that.
--- !Policy
id: "kojibuild_bodhipush_no_requirements"
product_versions:
  - fedora-*
decision_contexts:
  - bodhi_update_push_testing
  - bodhi_update_push_testing_critpath
  - bodhi_update_push_stable
  - bodhi_update_push_stable_critpath
subject_type: koji_build
rules: []

--- !Policy
id: "bodhiupdate_bodhipush_no_requirements"
product_versions:
  - fedora-*
decision_contexts:
  - bodhi_update_push_testing
  - bodhi_update_push_testing_critpath
  - bodhi_update_push_stable
  - bodhi_update_push_stable_critpath
subject_type: bodhi_update
rules: []

# The "remoterule" policy applies policies configured in individual
# package repositories. See Greenwave docs/policies.rst and
# https://docs.fedoraproject.org/en-US/ci/gating/ for details. Note
# we don't have a remoterule policy for bodhi_update subject type
# because Greenwave doesn't consider it to support remote rules.
--- !Policy
id: "kojibuild_bodhipush_remoterule"
product_versions:
  - fedora-rawhide
  - fedora-38
  - fedora-37
  - fedora-36
  - fedora-35
  - fedora-34
  - fedora-33
  - fedora-32
decision_contexts:
  - bodhi_update_push_testing
  - bodhi_update_push_testing_critpath
  - bodhi_update_push_stable
  - bodhi_update_push_stable_critpath
subject_type: koji_build
rules:
  - !RemoteRule {}

# For critical path updates in stable and Branched, we require passes
# for all openQA update tests. This policy contains the tests we run
# on all releases; there's an additional policy which contains tests
# not run on the oldest stable release (see below).
--- !Policy
id: "bodhiupdate_bodhipush_openqa"
product_versions:
  # FIXME: we would use some kind of matching here, but we don't want
  # to include whatever version Rawhide is, as openQA tests don't run
  # on Rawhide. So for now this list needs to be updated each time a
  # release is branched (or goes EOL).
  - fedora-35
  - fedora-36
  - fedora-37
decision_contexts:
  - bodhi_update_push_testing_critpath
  - bodhi_update_push_stable_critpath
subject_type: bodhi_update
rules:
# This list needs to stay synced with openQA if tests are added or renamed.
  - !PassingTestCaseRule {test_case_name: update.podman, scenario: "fedora.updates-container.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.podman_client, scenario: "fedora.updates-container.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.install_default_update_netinst, scenario: "fedora.updates-everything-boot-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.install_default_update_netinst, scenario: "fedora.updates-everything-boot-iso.x86_64.uefi"}
  - !PassingTestCaseRule {test_case_name: update.installer_build, scenario: "fedora.updates-everything-boot-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_reboot_unmount, scenario: "fedora.updates-kde.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_selinux, scenario: "fedora.updates-kde.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_service_manipulation, scenario: "fedora.updates-kde.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_services_start, scenario: "fedora.updates-kde.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_system_logging, scenario: "fedora.updates-kde.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_update_cli, scenario: "fedora.updates-kde.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.desktop_background, scenario: "fedora.updates-kde.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.desktop_browser, scenario: "fedora.updates-kde.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.desktop_printing, scenario: "fedora.updates-kde.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.desktop_terminal, scenario: "fedora.updates-kde.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.desktop_update_graphical, scenario: "fedora.updates-kde.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.install_default_update_live, scenario: "fedora.updates-kde-live-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.install_default_update_live, scenario: "fedora.updates-kde-live-iso.x86_64.uefi"}
  - !PassingTestCaseRule {test_case_name: update.live_build, scenario: "fedora.updates-kde-live-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.advisory_boot, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_reboot_unmount, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_selinux, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_service_manipulation, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_services_start, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_system_logging, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_update_cli, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.realmd_join_cockpit, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.realmd_join_sssd, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.server_cockpit_basic, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.server_cockpit_default, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.server_cockpit_updates, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.server_database_client, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.server_firewall_default, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.server_freeipa_replication_client, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.server_freeipa_replication_master, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.server_freeipa_replication_replica, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.server_remote_logging_client, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.server_remote_logging_server, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.server_role_deploy_database_server, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.server_role_deploy_domain_controller, scenario: "fedora.updates-server.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_reboot_unmount, scenario: "fedora.updates-workstation.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_selinux, scenario: "fedora.updates-workstation.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_service_manipulation, scenario: "fedora.updates-workstation.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_services_start, scenario: "fedora.updates-workstation.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_system_logging, scenario: "fedora.updates-workstation.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.base_update_cli, scenario: "fedora.updates-workstation.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.desktop_background, scenario: "fedora.updates-workstation.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.desktop_browser, scenario: "fedora.updates-workstation.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.desktop_printing, scenario: "fedora.updates-workstation.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.desktop_terminal, scenario: "fedora.updates-workstation.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.desktop_update_graphical, scenario: "fedora.updates-workstation.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.install_default_update_live, scenario: "fedora.updates-workstation-live-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.install_default_update_live, scenario: "fedora.updates-workstation-live-iso.x86_64.uefi"}
  - !PassingTestCaseRule {test_case_name: update.live_build, scenario: "fedora.updates-workstation-live-iso.x86_64.64bit"}

# For critical path updates in stable and Branched, we require passes
# for all openQA update tests. This policy contains upgrade tests that
# are not run on the oldest stable release (because the tests would
# need to start from an EOL release and we don't want to maintain that)
--- !Policy
id: "bodhiupdate_bodhipush_openqa_upgrade"
product_versions:
  - fedora-36
  - fedora-37
decision_contexts:
  - bodhi_update_push_testing_critpath
  - bodhi_update_push_stable_critpath
subject_type: bodhi_update
rules:
# This list needs to stay synced with openQA if tests are added or renamed.
  - !PassingTestCaseRule {test_case_name: update.upgrade_realmd_client, scenario: "fedora.updates-server-upgrade.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.upgrade_server_domain_controller, scenario: "fedora.updates-server-upgrade.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: update.upgrade_desktop_encrypted_64bit, scenario: "fedora.updates-workstation-upgrade.x86_64.64bit"}

# This policy lists tests that are expected to pass for a Rawhide compose to
# meet the basic release criteria.
--- !Policy
id: "compose_sync_requiredtests"
product_versions:
  - fedora-rawhide
decision_context: rawhide_compose_sync_to_mirrors
subject_type: compose
rules:
  - !PassingTestCaseRule {test_case_name: compose.cloud_autocloud, scenario: "fedora.Cloud_Base-qcow2-qcow2.x86_64.uefi"}
  - !PassingTestCaseRule {test_case_name: compose.base_system_logging, scenario: "fedora.KDE-live-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.base_system_logging, scenario: "fedora.Server-dvd-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.base_system_logging, scenario: "fedora.Workstation-live-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.base_update_cli, scenario: "fedora.KDE-live-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.base_update_cli, scenario: "fedora.Server-dvd-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.base_update_cli, scenario: "fedora.Workstation-live-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.desktop_browser, scenario: "fedora.KDE-live-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.desktop_browser, scenario: "fedora.Workstation-live-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.desktop_terminal, scenario: "fedora.KDE-live-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.desktop_terminal, scenario: "fedora.Workstation-live-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_anaconda_text, scenario: "fedora.universal.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_default, scenario: "fedora.Everything-boot-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_default, scenario: "fedora.Everything-boot-iso.x86_64.uefi"}
  - !PassingTestCaseRule {test_case_name: compose.install_default, scenario: "fedora.KDE-live-iso.x86_64.uefi"}
  - !PassingTestCaseRule {test_case_name: compose.install_default, scenario: "fedora.Server-boot-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_default, scenario: "fedora.Server-boot-iso.x86_64.uefi"}
  - !PassingTestCaseRule {test_case_name: compose.install_default, scenario: "fedora.Server-dvd-iso.x86_64.uefi"}
  - !PassingTestCaseRule {test_case_name: compose.install_default, scenario: "fedora.Workstation-live-iso.x86_64.uefi"}
  - !PassingTestCaseRule {test_case_name: compose.install_default_upload, scenario: "fedora.KDE-live-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_default_upload, scenario: "fedora.Server-dvd-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_default_upload, scenario: "fedora.Workstation-live-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_delete_pata, scenario: "fedora.universal.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_delete_pata, scenario: "fedora.universal.x86_64.uefi"}
  - !PassingTestCaseRule {test_case_name: compose.install_kickstart_firewall_configured, scenario: "fedora.universal.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_kickstart_firewall_disabled, scenario: "fedora.universal.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_kickstart_user_creation, scenario: "fedora.universal.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_mirrorlist_graphical, scenario: "fedora.universal.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_multi, scenario: "fedora.universal.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_multi, scenario: "fedora.universal.x86_64.uefi"}
  - !PassingTestCaseRule {test_case_name: compose.install_no_user, scenario: "fedora.KDE-live-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_repository_http_graphical, scenario: "fedora.universal.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_repository_http_variation, scenario: "fedora.universal.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_sata, scenario: "fedora.universal.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.install_sata, scenario: "fedora.universal.x86_64.uefi"}
  - !PassingTestCaseRule {test_case_name: compose.install_scsi_updates_img, scenario: "fedora.universal.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.realmd_join_sssd, scenario: "fedora.Server-dvd-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.server_cockpit_default, scenario: "fedora.Server-dvd-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.server_database_client, scenario: "fedora.Server-dvd-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.server_firewall_default, scenario: "fedora.Server-dvd-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.server_realmd_join_kickstart, scenario: "fedora.Server-dvd-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.server_role_deploy_database_server, scenario: "fedora.Server-dvd-iso.x86_64.64bit"}
  - !PassingTestCaseRule {test_case_name: compose.server_role_deploy_domain_controller, scenario: "fedora.Server-dvd-iso.x86_64.64bit"}

